package com.bjpowernode.crm.settings.service;

import com.bjpowernode.crm.commons.domain.ReturnObject;
import com.bjpowernode.crm.settings.domain.User;
import com.bjpowernode.crm.settings.dto.UserLoginDto;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 处理用户相关业务
 *
 * @author 刘逸晖
 */
public interface UserService {

    /**
     * 登录
     *
     * @param userLoginDto 用户名、密码等
     * @param request
     * @param response
     * @param session
     * @return 是否登录成功
     */
    ReturnObject login(UserLoginDto userLoginDto, HttpServletRequest request, HttpServletResponse response, HttpSession session);

    /**
     * 退出登录
     *
     * @param response
     * @param session
     */
    void logout(HttpServletResponse response, HttpSession session);

    /**
     * 查询所有用户
     *
     * @return 所有用户
     */
    List<User> queryAllUsers();

    /**
     * 根据名称模糊查询 id
     *
     * @param name 名称
     * @return id
     */
    List<String> queryIdsByName(@Param("name") String name);

    /**
     * 根据 id 查名称
     *
     * @param id id
     * @return 名称
     */
    String queryNameById(@Param("id") String id);

}
